// pages/yiliangfang/demand.js
Page({
  data: {

    index: -1,
    scrollviewheight: '',
    ci_rwdid: '',
    showView: true,
    showView2: true,
    showView3: true,
    showView4: true,
    ca_IntentionalStyle: '',       // 意向风格
    ca_SoftFurniture: '',          // 家具软装
    ca_IntelligentWeakCurrent: '', // 智能弱电
    ca_FengShuiRequirements: ''    // 风水要求

  },
  onLoad: function (options) {
    var that = this
    var ci_rwdid = options.ci_rwdid
    that.setData({
      ci_rwdid: options.ci_rwdid,
    })
    // 获取系统高度
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          scrollviewheight: res.screenHeight - 120
        })
      },
    })
    // 数据请求接口一
    that.requestData(that.data.ci_rwdid)
  },

  requestData: function (ci_rwdid) {
    var that = this

    wx.request({
      url: 'https://api.wenes.cn/JD/GetProDemandInfo?ci_rwdid=' + that.data.ci_rwdid,
      success: function (res) {
        console.log(res.data.Table)
        var item = res.data.Table[0]
        that.setData({
          WorksID: item.WorksID,
          CustomerID: item.CustomerID,
          ca_IntentionalStyle: item.ca_IntentionalStyle,
          ca_SoftFurniture: item.ca_SoftFurniture,
          ca_IntelligentWeakCurrent: item.ca_IntelligentWeakCurrent,
          ca_FengShuiRequirements: item.ca_FengShuiRequirements,
        })
      }
    })
  },

  // 页面跳转
  surroundings: function () {
    var that = this
    wx.redirectTo({
      url: 'surroundings?ci_rwdid=' + that.data.ci_rwdid + '&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID,
    })
  },
  measureroom: function () {
    var that = this
    wx.redirectTo({
      url: 'measureroom?ci_rwdid=' + that.data.ci_rwdid,
    })
  },
  upkeep: function () {
    var that = this
    wx.redirectTo({
      url: 'upkeep?ci_rwdid=' + that.data.ci_rwdid,
    })
  },

})